package com.xkdx.guangguang.sql;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class NotifySQLiteHelper extends SQLiteOpenHelper {
	public static String TAG = "SQLiteHelper";

	private int table;
	// notify
	private String TABNAME = "notify";
	public static String NOTIFYID = "notifyID";
	public static String MESSAGE = "Message";
	public static String OBJECTTYPE = "objectType";
	public static String OBJECTVALUE = "objectValue";
	public static String RETURNOBJECTTYPE = "returnObjectType";
	public static String RETURNOBJECTVALUE = "ReturnObjectValue";
	public static String DATA = "data";
	public static String ISREAD = "isRead";

	public NotifySQLiteHelper(Context context, String name, CursorFactory factory, int version) {
		super(context, name, factory, version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// Log.i(TAG, "onCreate");

		db.execSQL("CREATE TABLE IF NOT EXISTS " + TABNAME + "(" + NOTIFYID + " integer primary key autoincrement,"
				+ ISREAD + " varchar," + DATA + " varchar," + MESSAGE + " varchar," + OBJECTTYPE + " varchar,"
				+ OBJECTVALUE + " varchar," + RETURNOBJECTTYPE + " varchar," + RETURNOBJECTVALUE + " varchar)");
		
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// Log.i(TAG, "onUpgrade");
		db.execSQL("DROP TABLE IF EXISTS " + TABNAME);
		onCreate(db);
	}

}
